using Godot;
using System;

/// <summary>
/// 弹药盒类
/// </summary>
public partial class Pickup : Area3D
{
    [Export] public RoboRampage.Player.AmmonHandler.EnumTypeAmmo ExAmmoType; // 弹药类型

    [Export] public int ExAmmoCount = 20; // 弹药数量

    // 当有物体进入时调用
    public void OnBodyEntered(Node3D body)
    {
        // 检查进入的物体是否属于"player"组
        if (body.IsInGroup("player") )
        {
            var player =(RoboRampage.Player.Player) body;
            player.InAmmonHandler.AddAmmo(ExAmmoType, ExAmmoCount);
            // 如果是玩家，则调用QueueFree方法销毁当前节点
            QueueFree();
        }
    }
}